package gptma.bo.model.request;

import gptma.bo.model.BaseEntity;
import gptma.bo.model.project.Project;

import java.util.Date;

import javax.persistence.AttributeOverride;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.persistence.Transient;

import org.hibernate.annotations.BatchSize;

@BatchSize(size = 30)
// batch fetch requestEvaluation.clientRequest
@Entity
@Table(name = "demandedelfiimpl")
@AttributeOverride(name = "id", column = @Column(name = "demandeclientId"))
public class ClientRequest extends BaseEntity {

	private static final long serialVersionUID = -884922857053040987L;

	@Temporal(value = TemporalType.TIMESTAMP)
	@Column(name = "dateCreation")
	private Date creationDate;

	@Column(name = "auteur")
	private String creationAuthor;

	@Temporal(value = TemporalType.TIMESTAMP)
	@Column(name = "dateLastModif")
	private Date modificationDate;

	@Column(name = "objet")
	private String title;

	@Column(name = "description")
	private String description;

	@Column(name = "referenceClient")
	private String clientReference;

	@Column(name = "referenceAtos")
	private String internalReference;

	// TODO: LazyInitializationException is managed here (was lazy before)
	// find a better way to do that: either OSIV or FetchingStrategy object
	@ManyToOne
	@JoinColumn(name = "projetId")
	private Project project;

	@Enumerated(EnumType.STRING)
	@Column(name = "typeDC")
	private RequestType requestType;

	@Column(name = "environnement")
	private String environment;

	@Column(name = "severite")
	private String gravity;

	@Column(name = "priorite")
	private String priority;

	@Column(name = "version")
	private String deliveryVersion;

	@Temporal(value = TemporalType.TIMESTAMP)
	@Column(name = "dateVersion")
	private Date deliveryDate;

	@Column(name = "commentaireArbitrage")
	private String evaluationComment;

	@Column(name = "commentaireRealisation")
	private String realisationComment;

	@Column(name = "historiquePiecesJointes")
	private String attachmentHistory;

	@Column(name = "statutClient")
	private String clientStatus;

	@Column(name = "statutAtos")
	private String internalStatus;

	@Transient
	private String nextAction;

	/**
	 * @return the creationDate
	 */
	public Date getCreationDate() {
		return creationDate;
	}

	/**
	 * @param creationDate
	 *            the creationDate to set
	 */
	public void setCreationDate(Date creationDate) {
		this.creationDate = creationDate;
	}

	/**
	 * @return the creationAuthor
	 */
	public String getCreationAuthor() {
		return creationAuthor;
	}

	/**
	 * @param creationAuthor
	 *            the creationAuthor to set
	 */
	public void setCreationAuthor(String creationAuthor) {
		this.creationAuthor = creationAuthor;
	}

	/**
	 * @return the modificationDate
	 */
	public Date getModificationDate() {
		return modificationDate;
	}

	/**
	 * @param modificationDate
	 *            the modificationDate to set
	 */
	public void setModificationDate(Date modificationDate) {
		this.modificationDate = modificationDate;
	}

	/**
	 * @return the title
	 */
	public String getTitle() {
		return title;
	}

	/**
	 * @param title
	 *            the title to set
	 */
	public void setTitle(String title) {
		this.title = title;
	}

	/**
	 * @return the description
	 */
	public String getDescription() {
		return description;
	}

	/**
	 * @param description
	 *            the description to set
	 */
	public void setDescription(String description) {
		this.description = description;
	}

	/**
	 * @return the clientReference
	 */
	public String getClientReference() {
		return clientReference;
	}

	/**
	 * @param clientReference
	 *            the clientReference to set
	 */
	public void setClientReference(String clientReference) {
		this.clientReference = clientReference;
	}

	/**
	 * @return the internalReference
	 */
	public String getInternalReference() {
		return internalReference;
	}

	/**
	 * @param internalReference
	 *            the internalReference to set
	 */
	public void setInternalReference(String internalReference) {
		this.internalReference = internalReference;
	}

	/**
	 * @return the project
	 */
	public Project getProject() {
		return project;
	}

	/**
	 * @param project
	 *            the project to set
	 */
	public void setProject(Project project) {
		this.project = project;
	}

	/**
	 * @return the requestType
	 */
	public RequestType getRequestType() {
		return requestType;
	}

	/**
	 * @param requestType
	 *            the requestType to set
	 */
	public void setRequestType(RequestType requestType) {
		this.requestType = requestType;
	}

	/**
	 * @return the environment
	 */
	public String getEnvironment() {
		return environment;
	}

	/**
	 * @param environment
	 *            the environment to set
	 */
	public void setEnvironment(String environment) {
		this.environment = environment;
	}

	/**
	 * @return the gravity
	 */
	public String getGravity() {
		return gravity;
	}

	/**
	 * @param gravity
	 *            the gravity to set
	 */
	public void setGravity(String gravity) {
		this.gravity = gravity;
	}

	/**
	 * @return the priority
	 */
	public String getPriority() {
		return priority;
	}

	/**
	 * @param priority
	 *            the priority to set
	 */
	public void setPriority(String priority) {
		this.priority = priority;
	}

	/**
	 * @return the deliveryVersion
	 */
	public String getDeliveryVersion() {
		return deliveryVersion;
	}

	/**
	 * @param deliveryVersion
	 *            the deliveryVersion to set
	 */
	public void setDeliveryVersion(String deliveryVersion) {
		this.deliveryVersion = deliveryVersion;
	}

	/**
	 * @return the deliveryDate
	 */
	public Date getDeliveryDate() {
		return deliveryDate;
	}

	/**
	 * @param deliveryDate
	 *            the deliveryDate to set
	 */
	public void setDeliveryDate(Date deliveryDate) {
		this.deliveryDate = deliveryDate;
	}

	/**
	 * @return the evaluationComment
	 */
	public String getEvaluationComment() {
		return evaluationComment;
	}

	/**
	 * @param evaluationComment
	 *            the evaluationComment to set
	 */
	public void setEvaluationComment(String evaluationComment) {
		this.evaluationComment = evaluationComment;
	}

	/**
	 * @return the realisationComment
	 */
	public String getRealisationComment() {
		return realisationComment;
	}

	/**
	 * @param realisationComment
	 *            the realisationComment to set
	 */
	public void setRealisationComment(String realisationComment) {
		this.realisationComment = realisationComment;
	}

	/**
	 * @return the attachmentHistory
	 */
	public String getAttachmentHistory() {
		return attachmentHistory;
	}

	/**
	 * @param attachmentHistory
	 *            the attachmentHistory to set
	 */
	public void setAttachmentHistory(String attachmentHistory) {
		this.attachmentHistory = attachmentHistory;
	}

	/**
	 * @return the clientStatus
	 */
	public String getClientStatus() {
		return clientStatus;
	}

	/**
	 * @param clientStatus
	 *            the clientStatus to set
	 */
	public void setClientStatus(String clientStatus) {
		this.clientStatus = clientStatus;
	}

	/**
	 * @return the internalStatus
	 */
	public String getInternalStatus() {
		return internalStatus;
	}

	/**
	 * @param internalStatus
	 *            the internalStatus to set
	 */
	public void setInternalStatus(String internalStatus) {
		this.internalStatus = internalStatus;
	}

	/**
	 * @return the nextAction
	 */
	public String getNextAction() {
		return nextAction;
	}

	/**
	 * @param nextAction
	 *            the nextAction to set
	 */
	public void setNextAction(String nextAction) {
		this.nextAction = nextAction;
	}

}
